package com.shaw.client.mvc.goal;

import com.extjs.gxt.ui.client.Registry;
import com.extjs.gxt.ui.client.mvc.AppEvent;
import com.extjs.gxt.ui.client.mvc.Controller;
import com.extjs.gxt.ui.client.mvc.View;
import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.shaw.client.model.ui.AppMainUI;
import com.shaw.client.mvc.AppEvents;
import com.shaw.client.mvc.AppView;
import com.shaw.client.mvc.widgt.TaskPanel;


public class TaskView extends View {

  private TaskPanel panel;

  public TaskView(Controller controller) {
    super(controller);
  }

  @Override
  protected void initialize() {
    panel = new TaskPanel();
  }

  @Override
  protected void handleEvent(AppEvent event) {
    if (event.getType() == AppEvents.NavTasks) {
    	 LayoutContainer wrapper =( (AppMainUI) Registry.get(AppView.DESKTOP)).getCenter();
      wrapper.removeAll();
      wrapper.add(panel);
      wrapper.layout();
    }
  }
}
